package vip.xiaonuo.common.exception;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 业务异常
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ServiceException extends RuntimeException {
    /**
     * 错误编码
     */
    private Integer code;
    /**
     * 错误信息
     */
    private String message;

    public ServiceException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public ServiceException(Integer code, String message, Object... args) {
        super(StrUtil.format(message, args));
        this.code = code;
        this.message = StrUtil.format(message, args);
    }
}
